home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #9
/
Amiga Plus CD - 2004 - No. 09.iso
/
amigaplus
/
tools
/
dev_libs
/
feelin040718
/
sources
/
shade
/
gad.c
< prev
next >
Wrap
C/C++ Source or Header
|
2004-08-03
|
5KB
|
174 lines
#include "Private.h"
#include <intuition/gadgetclass.h>
#undef LocalObjectData
#define LocalObjectData GAD_LocalObjectData
/*** Methods ***************************************************************/
///Gad_New
F_METHOD(APTR,Gad_New)
{
struct LocalObjectData *LOD = F_LOD(Class,Obj);
struct TagItem *Tags = Msg;
LOD -> AreaData = (FAreaData *) F_Get(Obj,FA_AreaData);
if (LOD -> Type = GetTagData(FA_Gadget_Type,0,Tags))
{
if (F_SuperDo(Class,Obj,Method,
FA_ChainToCycle, FALSE,
FA_InputMode, (LOD -> Type == FV_GadgetType_Dragbar || LOD -> Type == FV_GadgetType_Size) ? FV_InputMode_None : FV_InputMode_Release,
TAG_MORE, Msg))
{
switch (LOD -> Type)
{
case FV_GadgetType_Close: F_Do(Obj,FM_Notify,FA_Pressed,FALSE,FV_Notify_Window,FM_Set,2,FA_Window_CloseRequest,TRUE); break;
case FV_GadgetType_Iconify: F_Do(Obj,FM_Notify,FA_Pressed,FALSE,FV_Notify_Application,FM_Set,2,FA_Application_Sleep,TRUE); break;
case FV_GadgetType_Zoom: F_Do(Obj,FM_Notify,FA_Pressed,FALSE,FV_Notify_Window,FM_Window_Zoom,1,FV_Window_Zoom_Toggle); break;
case FV_GadgetType_Depth: F_Do(Obj,FM_Notify,FA_Pressed,FALSE,FV_Notify_Window,FM_Window_Depth,1,FV_Window_Depth_Toggle); break;
}
return Obj;
}
}
return NULL;
}
//+
///Gad_Setup
F_METHOD(ULONG,Gad_Setup)
{
struct LocalObjectData *LOD = F_LOD(Class,Obj);
if (F_SUPERDO())
{
switch (LOD -> Type)
{
case FV_GadgetType_Dragbar:
{
if (F_Get(_win,FA_Window_GadDragbar))
{
if (!(LOD -> Gadget = NewObject(NULL,"buttongclass",GA_SysGType,GTYP_WDRAGGING,TAG_DONE))) return FALSE;
LOD -> Prep[0] = (STRPTR) F_Do(_app,FM_Application_Resolve,"FP_Decorator_APreParse",NULL);
LOD -> Prep[1] = (STRPTR) F_Do(_app,FM_Application_Resolve,"FP_Decorator_IPreParse",NULL);
LOD -> TDisplay = F_NewObj(FC_TextDisplay,
FA_TextDisplay_Font, _font,
FA_TextDisplay_Shortcut, FALSE,
TAG_DONE);
if (!F_Do(LOD -> TDisplay,FM_TextDisplay_Setup,_render))
{
return FALSE;
}
}
}
break;
case FV_GadgetType_Size:
{
if (!(LOD -> Gadget = NewObject(NULL,"buttongclass",GA_SysGType,GTYP_SIZING,TAG_DONE)))
{
return FALSE;
}
}
break;
}
return TRUE;
}
return FALSE;
}
//+
///Gad_Cleanup
F_METHOD(void,Gad_Cleanup)
{
struct LocalObjectData *LOD = F_LOD(Class,Obj);
if (LOD -> Gadget)
{
DisposeObject(LOD -> Gadget); LOD -> Gadget = NULL;
if (LOD -> TDisplay)
{
F_Do(LOD -> TDisplay,FM_TextDisplay_Cleanup);
F_DisposeObj(LOD -> TDisplay); LOD -> TDisplay = NULL;
}
}
F_SUPERDO();
}
//+
///Gad_Show
F_METHOD(ULONG,Gad_Show)
{
struct LocalObjectData *LOD = F_LOD(Class,Obj);
if (LOD -> Type == FV_GadgetType_Zoom)
{
F_Do(Obj,FM_ModifyHandler,IDCMP_MOUSEBUTTONS,0);
}
if (LOD -> Gadget && _render)
{
struct Window *osw = (APTR) F_Get(_win,FA_Window);
AddGadget(osw,LOD -> Gadget,-1);
}
return F_SUPERDO();
}
//+
///Gad_Hide
F_METHOD(ULONG,Gad_Hide)
{
struct LocalObjectData *LOD = F_LOD(Class,Obj);
if (LOD -> Type == FV_GadgetType_Zoom)
{
F_Do(Obj,FM_ModifyHandler,0,IDCMP_MOUSEBUTTONS);
}
if (LOD -> Gadget && _render)
{
struct Window *osw = (APTR) F_Get(_win,FA_Window);
RemoveGadget(osw,LOD -> Gadget);
}
return F_SUPERDO();
}
//+
///Gad_Layout
F_METHOD(void,Gad_Layout)
{
struct LocalObjectData *LOD = F_LOD(Class,Obj);
if (LOD -> Gadget)
{
SetAttrs(LOD -> Gadget,GA_Left, _x,
GA_Top, _y,
GA_Width, _w,
GA_Height, _h, TAG_DONE);
}
F_SUPERDO();
}
//+
///Gad_HandleEvent
F_METHODM(ULONG,Gad_HandleEvent,FS_HandleEvent)
{
// struct LocalObjectData *LOD = F_LOD(Class,Obj);
/*
if (LOD -> Type == FV_GadgetType_Zoom &&
Msg -> FEv -> Class == IDCMP_MOUSEBUTTONS)
{
/*
if (Msg -> FEv -> Code == MENUUP)
_inside(FEv -> MouseX,_x,_x + _w - 1) &&
_inside(FEv -> MouseY,_y,_y + _h - 1))
*/
F_Log(0,"MOUSE BUTTON");
}
*/
return F_SUPERDO();
}
//+